/**
 * @fileOverview 菜单
 * @author goodzsq@gmail.com
 */
var BaseClass = gg.module('ui.jq.Component');
module.exports = gg.createClass({
    attributes: {
        percent: {
            type: 'datatype.Number',
            setter: function(v) {
                this.defaultSetter('percent', v);
                if (v >= 100) {
                    this.el.hide();
                } else {
                    this.el.show();
                }
                var c = this.get('content');
                if (c) {
                    c.set('html', v + '%');
                }
            }
        },
        content: {
            type: 'ui.jq.Component',
            setter: function(v) {
                this.defaultSetter('content', v);
                if (v && v.el) {
                    var w = -parseInt(v.el.width() / 2), h = -parseInt(v.el.height() / 2);
                    v.el.css({
                        position: 'absolute',
                        top: '50%',
                        left: '50%',
                        marginLeft: w + 'px',
                        marginTop: h + 'px'
                    });
                    this.el.append(v.el);
                }
            }
        }
    },
    methods: {
        /**
         * @override
         */
        createElement: function() {
            this.el = $('<div id="' + this.cid + '" class="ui">');
            this.el.css({
                position: 'fixed',
                top: 0,
                left: 0,
                right: 0,
                bottom: 0,
                zIndex: 1000,
                backgroundColor: 'rgba(255, 255, 255, .5)'
            });
        }
    },
    events: {
    }
}, BaseClass, []);